#include "HCNInvokeInterface.h"
CHCNInvokeInterface g_HCNInvokeInterface;
CHCNInvokeInterface::CHCNInvokeInterface()
{
	m_hTBInvoke = (HMODULE) LoadLibrary(_T("HCNProtocal.dll"));
	if(!m_hTBInvoke)
	{
		return;
	}
//Radio Area
//	m_iRegisterRadioDataCallback =	(PFN_REGISTERRADIODATACALLBACK)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_RegisterRadioDataCallback"));
	m_iRadioBandChangeCmd =			(PFN_RAIDOBANDCHANGECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_BandChangeCmd"));
	m_iRadioTunerUpCmd =			(PFN_RADIOTUNERUPCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_TunerUpCmd"));
	m_iRadioTunerDownCmd =			(PFN_RADIOTUNERDOWNCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_TunerDownCmd"));
	m_iRadioSeekUpCmd =				(PFN_RADIOSEEKUPCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_SeekUpCmd"));
	m_iRadioSeekDownCmd =			(PFN_RADIOSEEKDOWNCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_SeekDownCmd"));
	m_iRadioLocCmd =				(PFN_RADIOLOCCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_LocCmd"));
	m_iRadioEQCmd =					(PFN_RADIOEQCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_EQCmd"));
	m_iRadioPresetChangeCmd =		(PFN_RADIOPRESETCHANGECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_PresetChangeCmd"));
	m_iRadioSavePresetChangeCmd =	(PFN_RADIOSAVEPRESETCHANGECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_SavePresetChangeCmd"));
	m_iRadioASCmd =					(PFN_RADIOASCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_ASCmd"));
	m_iRadioPSCmd =					(PFN_RADIOPSCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_PSCmd"));
	m_iRadioStereoCmd =				(PFN_RADIOSTEREOCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_StereoCmd"));
	m_iRadioTunerEnterCmd =			(PFN_RADIOTUNERENTERCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_TunerEnterCmd"));
	m_iRadioFadBalanceCmd =			(PFN_RADIOFADBALANCECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_FadBalanceCmd"));
	m_iRadioMuteCmd =				(PFN_RADIOMUTECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_MuteCmd"));
	m_iRadioDDBCmd =				(PFN_RADIODDBCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_DDBCmd"));
	m_iRadioScanCmd =				(PFN_RADIOSCANCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Radio_ScanCmd"));
//Common System Area
//FadBalance
//	m_iRegisterComBalanceCallback =	(PFN_REGISTERCOMBALANCECALLBACK)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_RegisterComBalanceCallback"));
//	m_iRegisterComSystemCallback =	(PFN_REGISTERCOMSYSTEMCALLBACK)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_RegisterComSystemCallback"));
	m_iCommonSystemVolumeCmd =		(PFN_COMMONSYSTEMVOLUMECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_SystemVolumeCmd"));
	m_iCommonLowPitchCmd =			(PFN_COMMONLOWPITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_LowPitchCmd"));
	m_iCommonHighPitchCmd =			(PFN_COMMONHIGHPITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_HighPitchCmd"));
	m_iCommonBalenceFrontCmd =		(PFN_COMMONBALENCEFRONTCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_BalenceFrontCmd"));
	m_iCommonBalenceLeftCmd =		(PFN_COMMONBALENCELEFTCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_BalenceLeftCmd"));
	m_iCommonFreqResponseCmd =		(PFN_COMMONFREQRESPONSECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_FreqResponseCmd"));
	m_iCommonEQCmd =				(PFN_COMMONEQCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_EQCmd"));
	m_iCommonLightnessCmd =			(PFN_COMMONLIGHTNESSCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_LightnessCmd"));
	m_iCommonContrastnessCmd =		(PFN_COMMONCONTRASTNESSCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_ComtrastnessCmd"));
	m_iCommonVideoSwitchCmd =		(PFN_COMMONVIDEOSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_VideoSwitchCmd"));
	m_iCommonDaySwitchCmd =			(PFN_COMMONDAYSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_DaySwitchCmd"));
	m_iCommonMuteSwitchCmd =		(PFN_COMMONMUTESWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_MuteSwitchCmd"));
	m_CommonTFTSwitchCmd =			(PFN_COMMONTFTSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_TFTSwitchCmd"));
	m_iCommonBreadAlarmSwitchCmd =	(PFN_COMMONBREAKALARMSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_BreakAlarmSwitchCmd"));
	m_iCommonAutoReverseCmd =		(PFN_COMMONAUTOREVERSECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_AutoReverseSwitchCmd"));
	m_iCommonRearMirrorSwitchCmd =	(PFN_COMMONREARMIRRORSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_RearMirrorSwitchCmd"));
	m_iCommonFrontMirrorSwitchCmd =	(PFN_COMMONFRONTMIRRORSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Common_FrontMirrorSwitchCmd"));

//General Setup
//	m_iRegisterSetupCallback =		(PFN_REGISTERSETUPCALLBACK)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_RegisterSetupCallback"));
	m_iSetupTimeModeSwitchCmd =		(PFN_SETUPTIMEMODESWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Setup_TimeModeSwitchCmd"));
	m_iSetupBeepSwitchCmd =			(PFN_SETUPBEEPSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Setup_BeepSwitchCmd"));
	m_iSetupLanguageSwitchCmd =		(PFN_SETUPLANGUAGESWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Setup_LanguageSwitchCmd"));
	m_iSetupAutoLogoSwitchCmd =		(PFN_SETUPAUTOLOGOSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Setup_AutoLogoSwitchCmd"));
	m_iSetupVolumeLimitSwitchCmd =	(PFN_SETUPVOLUMELIMITSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Setup_VolumeLimitSwitchCmd"));
	m_iSetupClockShowSwitchCmd =	(PFN_SETUPCLOCKSHOWSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Setup_ClockShowSwitchCmd"));	
	m_iSetupGpsListemSwitchCmd =	(PFN_SETUPGPSLISTEMSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Setup_GPSListenSwitchCmd"));	
	m_iSetupHandBreakSwitchCmd =	(PFN_SETUPHANDBREAKSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Setup_HandBreakSwitchCmd"));	
	m_iSetupRearMirrorSwitchCmd =	(PFN_SETUPREARMIRRORSWITCHCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Setup_RearMirrorSwitchCmd"));
//SWC
//	m_iRegisterSWCCallback =		(PFN_REGISTERSWCCALLBACK)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_SWC_RegisterSWCCallback"));
	m_iSWCEnterSWCCmd =				(PFN_SWCENTERSWCCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_SWC_EnterSWCCmd"));
	m_iSWCEscapeSWCCmd =			(PFN_SWCESCAPESWCCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_SWC_EscapeSWCCmd"));
	m_iSWCResetCmd =				(PFN_SWCRESETCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_SWC_ResetCmd"));
	m_iSWCSteerKeyCmd =				(PFN_SWCSTEERKEYCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_SWC_SteerKeyCmd"));

//Source
//	m_iRegisterSourceCallback =		(PFN_REGISTERSOURCECALLBACK)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_RegisterSourceCallback"));
	m_iSourceChangeModeCmd =		(PFN_SOURCECHANGEMODECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Source_ChangeModeCmd"));
	m_iSourceInvoteMenuSource =		(PFN_SOURCEINVOTEMENUSOURCE)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_Source_InvoteMenuSource"));

//MPEG
//	m_iRegisterMpegCallback =		(PFN_REGISTERMPEGCALLBACK)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_RegisterMpegCallback"));
	m_iMpegTouchPosCmd =			(PFN_MPEGTOUCHPOSCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_MPEG_TouchPosCmd"));
	m_iMpegTouchReleaseCmd =		(PFN_MPEGTOUCHRELEASECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_MPEG_TouchReleaseCmd"));

//Empty Wnd
//	m_iRegisterEmptyWndCallback =	(PFN_REGISTEREMPTYWNDCALLBACK)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_RegisterEmptyWndCallback"));

//Startup Wnd
//	m_iRegisterStartupWndCallback = (PFN_REGISTERSTARTUPWNDCALLBACK)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_RegisterStartupWndCallback"));
//20121031 add
//	m_iUpdateProtocalInfo =			(PFN_UPDATEPROTOCALINFO)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_UpdateProtocalInfo"));

/*******************HCN Protocal******************************/
	m_iInitialDeviceComm =			(PFN_INITIALDEVICECOMM)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_InitialDeviceComm"));
	m_iDeInitDevice =				(PFN_DEINITDEVICE)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_DeInitDevice"));

	m_iMcuInitCmd =					(PFN_MCUINITCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_McuInit"));
	m_iMcuDeviceStatusCmd =			(PFN_MCUDEVICESTATUSCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_McuDeviceStatus"));
	m_iArmReportStatusCmd =			(PFN_ARMREPORTSTATUSCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_ArmReportStatus"));
	m_iArmReportSourceStartCmd =	(PFN_ARMREPORTSOURCESTARTCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_ArmReportSourceStart"));
	m_iMcuChangeSourceCmd = 		(PFN_MCUCHANGESOURCECMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_ArmReportSourceStart"));
	m_iMcuSetAudioCmd =				(PFN_MCUSETAUDIOCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_McuSetAudio"));
	m_iMcuSetEQCmd =				(PFN_MCUSETEQCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_McuSetEQ"));
	m_iMcuSettingsCmd = 			(PFN_MCUVERSIONCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_McuSettings"));
	m_iMcuVersionCmd =  			(PFN_MCUSETTINGSCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_McuVersion"));
	m_iMcuCanCmd =   				(PFN_MCUSWCCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_McuCan"));
	m_iMcuRadioInfoCmd =			(PFN_MCUSWCCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_McuSWC"));

//swc
	m_iMcuSWCCmd =   				(PFN_MCUSWCCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_McuSWC"));
	m_iMcuSwcSimpleCmd =			(PFN_MCUSWCCMD)(GetProcAddress(m_hTBInvoke,L"HCNPROTOCAL_McuSWCSimpleReq"));
}

CHCNInvokeInterface::~CHCNInvokeInterface()
{
#ifdef _DEBUG
	printf("CTBInvokeInterface::~CTBInvokeInterface()\r");
#endif
	FreeLibrary(m_hTBInvoke);
}